package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.ArticleFeedbackService;
import com.wenwan.manage.setting.DefaultValue;

import javax.annotation.Resource;

/**
 * 普通文章举报反馈
 */
@Controller
@RequestMapping(value = "/article/feedback")
public class ArticleFeedbackController {

	@Autowired
	private ArticleFeedbackService articleFeedbackService;

	/**
	 * 举报文章
	 * 
	 * @param articleId
	 *            文章ID
	 * @param userId
	 *            举报者
	 * @param content
	 *            举报内容
	 * @param images
	 *            举报的图片
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/create", method = { RequestMethod.POST })
	public Map<String,Object> create(@RequestParam(required = true) String articleId,
			@RequestParam(required = true) String userId, @RequestParam(required = true) String content,
			@RequestParam(required = false) String images) {
		return articleFeedbackService.create(articleId, userId, content, images);
	}

	@ResponseBody
	@RequestMapping(value = "/select/all", method = { RequestMethod.GET })
	public Map<String,Object> selectAll(
			@RequestParam(required = false, defaultValue = DefaultValue.CURRENT_PAGE) Integer currentPage,
			@RequestParam(required = false, defaultValue = DefaultValue.PAGE_SIZE) Integer pageSize) {
		return articleFeedbackService.selectAll(currentPage, pageSize);
	}

}
